<?php

namespace app\model;

use think\model\concern\SoftDelete;

/**
 *基础模型类
 */
class AdminModel extends BaseModel
{

    use SoftDelete;
    
    protected $name = 'admin';

    public static function getList($params = []){

        $limit = $params['limit'] ?? 15;

        $list = self::where(function($query) use ($params){

        })->order("id asc")->paginate($limit)->each(function($item){
            //处理角色显示
            $item->roles_str = '';
            if(!empty($item->roles)){
                $item->roles_str = implode(",",AdminRolesModel::where("id",'in',$item->roles)->column('name'));
            }
        });

        return $list;
    }
    
}